{% extends 'base.html' %}
{% block content %}
<h2>{{ competition.name }} 详情</h2>
<p>描述：{{ competition.description }}</p>
<p>开始日期：{{ competition.start_date }}</p>
<p>结束日期：{{ competition.end_date }}</p>
<h3>已报名学员</h3>
<ul>
    {% for signup in signups %}
        <li>{{ signup.student.real_name or signup.student.username }}（报名时间：{{ signup.signup_time }}）</li>
    {% else %}
        <li>暂无报名</li>
    {% endfor %}
</ul>
{% if current_user.is_student() %}
    <form method="post" action="{{ url_for('student_reservations.monthly_competition_signup', comp_id=competition.id) }}">
        {{ signup_form.hidden_tag() }}
        <div class="form-group mb-2">
            {{ signup_form.group.label }}
            {{ signup_form.group(class="form-select") }}
        </div>
        <div class="mb-2 text-danger">报名费：30元，自动从账户余额扣除</div>
        <button type="submit" class="btn btn-success">报名参加</button>
    </form>
    <a href="{{ url_for('student_reservations.my_competition_matches', comp_id=competition.id) }}" class="btn btn-info mt-2">查看我的赛程</a>
{% endif %}
{% if current_user.is_super_admin() or current_user.is_campus_admin() %}
    <form method="post" action="{{ url_for('student_reservations.generate_competition_schedule', comp_id=competition.id) }}" class="d-inline">
        <button type="submit" class="btn btn-warning">生成赛程</button>
    </form>
{% endif %}
<a href="{{ url_for('student_reservations.monthly_competitions') }}" class="btn btn-secondary">返回列表</a>
{% endblock %}
